﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CharacterTool
{
    public class CAnimation
    {
        // Public data members for easy access
        public float m_fMin = 0.0f, m_fMax = 0.0f;
        public float m_fSpeed = 0.0f;
        public bool m_bAnimateDir = false;
        public bool m_bInitialDir = false;

        public CAnimation()
        {
            m_fMin = 0.0f;
            m_fMax = 0.0f;
            m_fSpeed = 0.0f;
            m_bAnimateDir = false;
            m_bInitialDir = false;
        }

        public void Play(ref float m_fAngle)
        {
            if (m_bAnimateDir == false)
            {
                if (m_fAngle < m_fMax)
                {
                    m_fAngle += m_fSpeed;
                }
                else
                    m_bAnimateDir = true;
            }
            else
            {
                if (m_fAngle > m_fMin)
                {
                    m_fAngle -= m_fSpeed;
                }
                else
                    m_bAnimateDir = false;

            }
        }

    }
}
